#include "ros/ros.h"
#include "std_msgs/String.h"
#include "pix_control/pix_auto_control.h"

#include <sstream>

/**
 * This tutorial demonstrates simple sending of messages over the ROS system.
 */
int main(int argc, char **argv)
{
  ros::init(argc, argv, "talker");

  ros::NodeHandle n;

  ros::Publisher chatter_pub = n.advertise<pix_control::pix_auto_control>("chatter", 1000);

  ros::Rate loop_rate(10);

  int count = 0;
  while (ros::ok())
  {
    pix_control::pix_auto_control msg;

    msg.speed_value = count;
    msg.brake_value = count;
    msg.steering_value = count;
    msg.gear_shift = 1;
    msg.mode_selection = 1;
    msg.is_turn_right = 1;
    msg.is_brake = 1;
    msg.is_turn_right = 1;
    msg.is_EPB = 1;
    msg.is_turn_on_headlamp = 1;
    msg.switch_normal_advanced_mode = 1;
    msg.switch_low_high_speed = 1;
    msg.switch_disable_enable_auto = 1;

    ROS_INFO("%d", msg.speed_value);

    chatter_pub.publish(msg);

    ros::spinOnce();

    loop_rate.sleep();
    ++count;
  }


  return 0;
}